package logic

import (
	"context"
	"goods_srv/elasticsearch"

	"goods_srv/goods"
	"goods_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type SyncGoodsLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSyncGoodsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SyncGoodsLogic {
	return &SyncGoodsLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 同步商品
func (l *SyncGoodsLogic) SyncGoods(in *goods.SyncGoodsRequest) (*goods.SyncGoodsResponse, error) {
	// todo: add your logic here and delete this line

	elasticsearch.SyncGoodsToEs()

	return &goods.SyncGoodsResponse{}, nil
}
